import 'package:flutter/material.dart';

/**
 * 紧凑按钮
 */
class CompactButton extends StatelessWidget {
  final String text;

  final Color color;

  final Color textColor;

  final VoidCallback onPress;

  final double fontSize;
  final int maxLines;


  CompactButton(
      {Key key,
      this.text,
      this.color,
      this.textColor,
      this.onPress,
      this.fontSize = 12.0,
      this.maxLines = 1})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return new GestureDetector(
        child: new Text(text,
            style: new TextStyle(fontSize: fontSize,color: textColor),
            maxLines: maxLines,
            overflow: TextOverflow.ellipsis),
        onTap: () {
          this.onPress?.call();
        });
  }
}
